<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:a="http://richfaces.org/a4j"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:rg="http://www.ruijie.com.cn/faces/ui"
	xmlns:c="http://java.sun.com/jstl/core"
	template="/layout/contentLayout.xhtml">

	<ui:define name="road">
		<span><h:outputLink value="/luyuan/sale/orderListForSale.jsf">我的订单</h:outputLink> &gt;&gt; 新建订单 </span>
	</ui:define>

	<!-- content -->
	<ui:define name="content">
		<rg:areaPanel>
			<rg:wizardPanel id="orderWizard">
				<rg:titlePanel id="shippingInfo" headerTitle="配送信息">
					<rg:fieldSet>
						<rg:selectOne id="customer" label="请选择收货人" value="#{param_action.customer}"  singleLine="true"
		                    converter="#{accountMemberConverter}" itemsProvider="#{accountMemberProvider}" rendered="#{empty param_action.order.id and param_action.isMember()}"
		                    enableEmpty="true" emptyItemLabel="新建收货人">
		                    <a:support event="onchange" actionListener="#{param_action.onCustomerChange()}"
							reRender="deliveryInfo" ajaxSingle="true" />
						</rg:selectOne>
					</rg:fieldSet>
					<h:panelGroup id="deliveryInfo"  layout="block">
					<rg:fieldSet id="" column="double">
						<rg:inputText id="memberName" value="#{param_action.order.delivery.receiver}"
							label="收货人"  request="true"/>
						<rg:inputText id="phone" value="#{param_action.order.delivery.deliveryPhone}" label="收货人电话" request="true"/>
	                    <rg:field id="address" label="收货地址"  singleLine="true">
	                    	<h:selectOneMenu id="province" value="#{param_action.order.delivery.deliveryAddress.province}" 
	                    		styleClass="select"  style="margin-right:10px"
                    			onchange="jQuery('#orderWizard_form\\:city').val(null);jQuery('#orderWizard_form\\:region').val(null);">
                    			<f:selectItem itemLabel="请选择省"/>
	                    		<f:selectItems value="#{provinceProvider.getSelectItems(null)}"/>
	                    	</h:selectOneMenu>
	                    	<h:selectOneMenu id="city" value="#{param_action.order.delivery.deliveryAddress.city}" 
	                    		styleClass="select"  style="margin-right:10px"
                    			onchange="jQuery('#orderWizard_form\\:region').val(null);">
                   				<f:selectItem itemLabel="请选择市"/>
	                    		<f:selectItems value="#{cityProvider.getSelectItems(param_action.order.delivery.deliveryAddress.province)}" />
                    			<rg:reference for="province" actionListener="#{param_action.onProvinceChange}" eventsQueue="address"/>
	                    	</h:selectOneMenu>
	                    	<h:selectOneMenu id="region" value="#{param_action.order.delivery.deliveryAddress.region}" 
	                    		styleClass="select"  style="margin-right:10px">
                   				<f:selectItem itemLabel="请选择区（县）"/>
	                    		<f:selectItems value="#{regionProvider.getSelectItems(param_action.order.delivery.deliveryAddress.province,param_action.order.delivery.deliveryAddress.city)}" />
                    			<rg:reference for="province,city" actionListener="#{param_action.onCityChange}" eventsQueue="address"/>
	                    	</h:selectOneMenu>
	                    	<h:inputText request="true" id="street" value="#{param_action.order.delivery.deliveryAddress.street}" styleClass="text" style="width:256px;"/>
	                    </rg:field>
						<rg:inputText id="postCode" label="#{messages.luyuan_member_postCode}" value="#{param_action.order.delivery.deliveryAddress.postCode}" >
							<rg:reference for="city,region" actionListener="#{param_action.resetPostCode}" eventsQueue="address"/>
						</rg:inputText>
						<rg:selectOne id="shipMethodType" enableEmpty="true" 
							value="#{param_action.order.delivery.expressCompany}" label="快递方式"
							itemsProvider="#{expressCompanyProvider}" converter="#{expressCompanyConverter}" singleLine="true" />
					</rg:fieldSet>
					</h:panelGroup>
				</rg:titlePanel>
				
				<rg:titlePanel id="orderPayType" headerTitle="付款方式">
					<rg:fieldSet column="double">
						<rg:selectOne id="payMethodType"
							value="#{param_action.order.paymentType}" label="付款方式"
							itemsProvider="#{paymentTypeProvider}" converter="#{paymentTypeConverter}"/>
					</rg:fieldSet>
				</rg:titlePanel>
			</rg:wizardPanel>
		</rg:areaPanel>
	</ui:define>
</ui:composition>